package com.feicheng.service;

import com.feicheng.common.constant.Constant;
import com.feicheng.service.impl.FAdminPasswordLoginServiceImpl;
import com.feicheng.service.impl.FTelMessageLoginServiceImpl;
import com.feicheng.service.impl.FWxAppCodeLoginServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class ServiceBeanManager {

    @Autowired
    FAdminPasswordLoginServiceImpl fAdminPasswordLoginServiceImpl;

    @Autowired
    FTelMessageLoginServiceImpl fTelMessageLoginServiceImpl;

    @Autowired
    FWxAppCodeLoginServiceImpl fWxAppCodeLoginService;


    private Map<String, IFLoginService> systemLoginServiceMap = new HashMap<String, IFLoginService>();

    private Map<String, IFLoginService> clientLoginServiceMap = new HashMap<String, IFLoginService>();

    @Bean(name="main-system-login")
    public Map<String, IFLoginService> getSystemLoginServiceBean() {
        systemLoginServiceMap.put(Constant.LOGIN_TYPE.AP, fAdminPasswordLoginServiceImpl);
        systemLoginServiceMap.put(Constant.LOGIN_TYPE.TM, fTelMessageLoginServiceImpl);
        return systemLoginServiceMap;
    }

    @Bean(name="client-login")
    public Map<String, IFLoginService> getClientLoginServiceBean() {
        clientLoginServiceMap.put(Constant.LOGIN_TYPE.WX_JSCODE, fWxAppCodeLoginService);
        return clientLoginServiceMap;
    }


}
